package cn.iocoder.yudao.module.bpm.framework.flowable.core.listener;


import cn.iocoder.yudao.module.system.api.a_gaojian.GaoJianApi;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.JavaDelegate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 三审三校流程结束时将稿件审核状态改为 已完成
 *
 * @author lxj
 */
@Component("GaoJianBpmListener")
public class GaoJianBpmListener implements JavaDelegate {

    @Resource
    private GaoJianApi gaoJianApi;

    @Override
    public void execute(DelegateExecution delegateExecution) {
        //审核完成修改审核状态位3已审核完成
        if (delegateExecution.getVariable("dataType") != null && delegateExecution.getVariable("id") != null) {
            String dataType = delegateExecution.getVariable("dataType").toString();
            String id = delegateExecution.getVariable("id").toString();
            //审核完成修改审核状态位3已审核完成
            gaoJianApi.updateReview(id, dataType, 3);
        }
    }
}

